//
//  YJPopoverViewController.swift
//  YJWeiBo
//
//  Created by Jim1024 on 2017/1/16.
//  Copyright © 2017年 Jim1024. All rights reserved.
//

import UIKit

class YJPopoverViewController: UITableViewController {
    
    fileprivate let kReuseIdentifier = "ReuseIdentifier"
    let titles = ["首页", "好友圈", "群微博", "我的微博", "新浪微博"]
    var dismissHandle: (()->())?

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor.clear
        
        tableView.register(UITableViewCell.self, forCellReuseIdentifier: kReuseIdentifier)
    }

    // MARK: - Table view data source

    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        
        return titles.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: kReuseIdentifier, for: indexPath)
        cell.backgroundColor = UIColor.clear
        cell.textLabel?.text = titles[indexPath.row]
        return cell
    }
    
    // MARK: - Table view delegate
    
    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
        dismissHandle?()
        dismiss(animated: true, completion: nil)
    }

}
